﻿using _051_Generics;
using static System.Console;

/*
 * 泛型
 */

Box<int> boxInt = new Box<int>();
boxInt.SetValue(10);
WriteLine(boxInt.GetValue());

Box<string> boxString = new Box<string>();
boxString.SetValue("hello");
WriteLine(boxString.GetValue());


Show<int>(5);
Show<string>("泛型");
Show<DateTime>(DateTime.Now);


// 泛型方法
static void Show<T>(T para)
{
    WriteLine($"{para.GetType().Name}");
    WriteLine($"{para.ToString()}");
}

ReadLine();